extends BaseClass

class_name Point

var x:int
var y:int

func init(a, b):
	x=a
	y=b

func initWithVector2(v:Vector2):
	x = v.x
	y = v.y

func equals(p)->bool:
	return x==p.x && y==p.y

func toVector()->Vector2:
	return Vector2(x, y)
	
func neighbor(p)->bool:
	if x == p.x:
		return abs(y-p.y) == 1
	elif y==p.y:
		return abs(x-p.x) == 1
	else:
		return false

func toString():
	var formatString = "(%d,%d)"
	return formatString % [x, y]
	
